package com.zuser.project.controller;

import com.zuser.project.entity.DriverAccountDetailEntity;
import com.zuser.project.service.DriverAccountDetailService;
import com.zuser.project.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;


/**
 * 司机账户明细
 *
 * @author zuser
 * @email 2076033693@gmail.com
 * @date 2025-04-01 14:49:39
 */
@RestController
@RequestMapping("/driver/driveraccountdetail")
public class DriverAccountDetailController {
    @Autowired
    private DriverAccountDetailService driverAccountDetailService;

    /**
     * 列表
     */
    @GetMapping("/list")
    //("generator:driveraccountdetail:list")
    public R list(@RequestParam Map<String, Object> params){
        return driverAccountDetailService.queryPage(params);

//         R.ok().put("page", page);
    }


    /**
     * 信息
     */
 @GetMapping("/info/{id}")    //("generator:driveraccountdetail:info")
    public R info(@PathVariable("id") Long id){
		DriverAccountDetailEntity driverAccountDetail = driverAccountDetailService.getById(id);

        return R.ok().put("driverAccountDetail", driverAccountDetail);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    //("generator:driveraccountdetail:save")
    public R save(@RequestBody DriverAccountDetailEntity driverAccountDetail){
		driverAccountDetailService.save(driverAccountDetail);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public R update(@RequestBody DriverAccountDetailEntity driverAccountDetail){
		driverAccountDetailService.updateById(driverAccountDetail);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    //("generator:driveraccountdetail:delete")
    public R delete(@RequestBody Long[] ids){
		driverAccountDetailService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
